package it.patterns.creational.prototype;

public class ConcretePrototypeB extends Prototype {

	private int secs;

	public void setTime(int hr, int min, int sec) {
		secs = hr * 3600 + min * 60 + sec;
	}

	public int getHours() {
		return secs / 3600;
	}

	public int getMinutes() {
		return (secs - getHours() * 3600) / 60;
	}

	public int getSeconds() {
		return secs % 60;
	}

	@Override
	public Prototype cloneItself() {
		ConcretePrototypeB myClone = new ConcretePrototypeB();
		myClone.setTime(0, 0, 0);
		return myClone;
	}

}
